package com.yunhe.policyfulfillment.policyful.controller;
import com.yunhe.common.model.ResultObject;
import com.yunhe.policyfulfillment.policyful.service.PolicyApplyMatterStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.ParseException;

/**
 * @description 申请事项处理统计分析
 * @author misty
 * @date 2021-09-18
 */
@Api(value = "PolicyApplyMatterStatistics", description = "申请事项处理统计分析维护", tags = {"Model_PolicyApplyMatterStatistics"})
@RestController
@RequestMapping(value = "/policyApplyMatterStatistics")
public class PolicyApplyMatterStatisticsController {

    @Autowired
    private PolicyApplyMatterStatisticsService policyApplyMatterStatisticsService;

    @ApiOperation("政策申请统计")
    @PostMapping("/applyMatterStatistics")
    public ResponseEntity<ResultObject> applyMatterStatistics(@RequestParam(value = "time",required = true) String time){
        return new ResponseEntity<>(new ResultObject<>(policyApplyMatterStatisticsService.applyMatterStatistics(time)), HttpStatus.OK);
    }

    @ApiOperation("资金发放统计")
    @PostMapping("/fundReleaseStatistics")
    public ResponseEntity<ResultObject> fundReleaseStatistics(@RequestParam(value = "time",required = true) String time){
        return new ResponseEntity<>(new ResultObject<>(policyApplyMatterStatisticsService.fundReleaseStatistics(time)), HttpStatus.OK);
    }

    @ApiOperation("审批统计分析")
    @PostMapping("/approvalStatisticalAnalysis")
    public ResponseEntity<ResultObject> approvalStatisticalAnalysis(@RequestParam(value = "time",required = true) String time,
                                                                    @RequestParam(value = "orgType",required = true) String orgType) throws ParseException {
        return new ResponseEntity<>(new ResultObject<>(policyApplyMatterStatisticsService.approvalStatisticalAnalysis(time, orgType)), HttpStatus.OK);
    }

}